﻿#ifndef MAINWIDGET_H
#define MAINWIDGET_H

#include <QWidget>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>
#include <QCloseEvent>
#include <QComboBox>
#include <QLabel>
#include <QLineEdit>
#include <QGridLayout>
#include "server.h"
#include "device.h"
#include <QAction>
#include <QMenu>
#include <QIcon>
#include <QMessageBox>
#include <QDebug>
#include <QSystemTrayIcon>

class MainWidget : public QWidget
{
    Q_OBJECT

public:
    MainWidget(QWidget *parent = 0);
    void captureAudio();
    ~MainWidget();
protected:
    void closeEvent(QCloseEvent *event);
private:
    device m_audio_device;

    bool m_status;
    bool m_exit;
    Server m_server;
    void setUi();
    void getDevice();
    QStringList m_device_list;
    QVBoxLayout* m_mainlayout;
    QPushButton* m_btStart;

    QLabel* m_lbStatus;

    QVBoxLayout* m_devicelayout;
    QLabel* m_lbDevice;
    QComboBox* m_cbDevice;

    QHBoxLayout* m_closelayout;
    QLabel* m_lbCloseSelect;
    QComboBox* m_cbCloseSelect;

    //托盘
    void createTray();
    QAction *m_minimizeAction;
    QAction *m_restoreAction;
    QAction *m_quitAction;

    QSystemTrayIcon *m_trayIcon;
    QMenu *m_trayIconMenu;

};

#endif // MAINWIDGET_H
